package com.qingge.springboot.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qingge.springboot.entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 黎俊
 * @since 2022-06-13
 */
public interface OrdersMapper extends BaseMapper<Orders> {

    Page<Orders> page(Page<Object> page, @Param("name") String name,@Param("role") String role,@Param("id") Integer id);

    @Update("update  orders set  state= #{state}, pay_time=#{payTime},alipay_no=#{alipayNo} where no =#{no}")
    //@Param里面的对应数据的字段 ， String tradeNo ...这些的传过来的字段
    int updateState(@Param("no") String tradeNo, @Param("state") String state, @Param("payTime") String gmtPayment,@Param("alipayNo") String alipayTradeNo);
@Select("select  * from orders where no =#{traceNo}")
    Orders getByNo( String traceNo);
    @Update("update  orders set state=#{state} , return_time=#{time} where no = #{no}  ")
    int updatePayState(@Param("no") String tradeNo, String state, String time);
}
